package com.dsd.datav.controller;

import com.dsd.datav.constants.Result;
import com.dsd.datav.dto.LoginUser;
import com.dsd.datav.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Administrator
 * @Title: UserController
 * @ProjectName datav
 * @Description: TODO
 * @date 2024/2/26 00262024/2/26 0026
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;
    @PostMapping("/login")
    public Result login(LoginUser loginUser){
        LoginUser userLogin = userService.login(loginUser);
        if (StringUtils.isEmpty(userLogin)) {
            return Result.failure();
        }
        else{
            return Result.success(loginUser);
        }
    }
}
